Skip to content

Added shell and timeout, killSignal options to spawn functions #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Breaking changes:

New features:

- Added `shell` and `timeout`, `killSignal` options to `spawn` functions

Bugfixes:

Other improvements:
Expand Down
9 changes: 9 additions & 0 deletions src/Node/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ spawn cmd args = spawnImpl cmd args <<< convertOpts
{ cwd: fromMaybe undefined opts.cwd
, stdio: toActualStdIOOptions opts.stdio
, env: toNullable opts.env
, shell: fromMaybe undefined opts.shell
, timeout: fromMaybe undefined opts.timeout
, killSignal: fromMaybe undefined opts.killSignal
, detached: opts.detached
, uid: fromMaybe undefined opts.uid
, gid: fromMaybe undefined opts.gid
Expand All @@ -263,6 +266,9 @@ type SpawnOptions =
{ cwd :: Maybe String
, stdio :: Array (Maybe StdIOBehaviour)
, env :: Maybe (Object String)
, shell :: Maybe String
, timeout :: Maybe Number
Comment on lines +269 to +270
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types for these probably aren't quite ideal - I'd suggest using Milliseconds for timeout, and shell perhaps needs a new sum type that covers the true argument. I've actually never used anything but true, thought it was a mistake here until I checked the node docs!

, killSignal :: Maybe Signal
, detached :: Boolean
, uid :: Maybe Uid
, gid :: Maybe Gid
Expand All @@ -275,6 +281,9 @@ defaultSpawnOptions =
{ cwd: Nothing
, stdio: pipe
, env: Nothing
, shell: Nothing
, timeout: Nothing
, killSignal: Nothing
, detached: false
, uid: Nothing
, gid: Nothing
Expand Down