Skip to content

Commit

Permalink
update error log
Browse files Browse the repository at this point in the history
  • Loading branch information
POPPIN-FUMI committed Dec 12, 2024
1 parent 90bc8c9 commit f29337d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elsoul/child-process",
"version": "1.1.0",
"version": "1.2.0",
"description": "Deno child process module",
"runtimes": ["deno"],
"exports": "./mod.ts",
Expand Down
12 changes: 4 additions & 8 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,14 @@ export const exec = async (cmd: string, cwd?: string): Promise<ExecResult> => {

if (code !== 0) {
const errorOutput = new TextDecoder().decode(stderr).trim()
throw new Error(
`Failed to execute command: ${cmd}\nError output: ${errorOutput}`,
)
return {
success: false,
message: errorOutput,
}
}

const output = new TextDecoder().decode(stdout).trim()

const errorOutput = new TextDecoder().decode(stderr).trim()
if (errorOutput) {
console.error(errorOutput)
}
return {
success: true,
message: output,
Expand All @@ -147,7 +144,6 @@ const handleError = (error: unknown): ExecResult => {
message: error.message,
}
} else {
console.error('Unknown error:', error)
return {
success: false,
message: 'An unknown error occurred',
Expand Down

0 comments on commit f29337d

Please sign in to comment.