Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The `Process.run` function is the easiest way to execute a command and capture i
(IO.println (Output.stdout &output))
(let [status (Output.status &output)]
(if @(ExitStatus.exited? status)
(IO.println &(format "Exited with code: %d" @(ExitStatus.code status)))
(IO.println &(format "Killed by signal: %d" @(ExitStatus.signal status))))))))
(IO.println &(unsafe-format "Exited with code: %d" @(ExitStatus.code status)))
(IO.println &(unsafe-format "Killed by signal: %d" @(ExitStatus.signal status))))))))
```

## Deadlock-Safe Execution
Expand Down
10 changes: 7 additions & 3 deletions test/process_test.carp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(Result.Error err)
(assert-true process-test-state
false
&(format "Failed to spawn 'ls': %s" &err)))
&(unsafe-format "Failed to spawn 'ls': %s" &err)))
;; Test 2: Command & Run (Capture Output)
cmd2 (Command.new "echo")
cmd-with-args2 (Command.arg cmd2 "hello carp")
Expand Down Expand Up @@ -48,7 +48,9 @@
@(ExitStatus.code &status)
"Custom exit code via 'sh'"))
(Result.Error err)
(assert-true &s5 false &(format "Failed to spawn 'sh': %s" &err)))
(assert-true &s5
false
&(unsafe-format "Failed to spawn 'sh': %s" &err)))
;; Test 5: Deadlock prevention with run-combined (Large output)
cmd5 (Command.new "python3")
cmd5-args (Command.arg cmd5 "-c")
Expand Down Expand Up @@ -93,7 +95,9 @@ t1.start(); t2.start(); t1.join(); t2.join()")
(not @(ExitStatus.exited? &status))
"Process killed by signal did not exit normally")))
(Result.Error err)
(assert-true &s8 false &(format "Failed to spawn 'sleep': %s" &err)))
(assert-true &s8
false
&(unsafe-format "Failed to spawn 'sleep': %s" &err)))
;; Test 8: Stdin piping
cmd8 (Command.new "cat")
cmd8-in (Command.set-stdin cmd8 "carp stdin test")
Expand Down
Loading