Skip to content

Format via purs-tidy #42

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

Merged
merged 4 commits into from
Jul 20, 2023
Merged
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"
purs-tidy: "latest"

- uses: actions/setup-node@v3
with:
Expand All @@ -33,3 +34,8 @@ jobs:
run: |
bower install
npm run-script test --if-present

- name: Check formatting
run: |
purs-tidy check src test

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Bugfixes:
Other improvements:
- Bumped CI's node version to `lts/*` (#41 by @JordanMartinez)
- Updated CI `actions/checkout` and `actions/setup-nodee` to `v3` (#41 by @JordanMartinez)
- Format codebase & enforce formatting in CI via purs-tidy (#42 by @JordanMartinez)

## [v9.0.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v9.0.0) - 2022-04-29

Expand Down
11 changes: 5 additions & 6 deletions src/Node/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type ChildProcessRec =
, pid :: Pid
, connected :: Boolean
, kill :: String -> Unit
, send :: forall r. Fn2 { | r} Handle Boolean
, send :: forall r. Fn2 { | r } Handle Boolean
, disconnect :: Effect Unit
}

Expand All @@ -110,8 +110,8 @@ stderr = unsafeFromNullable (missingStream "stderr") <<< _.stderr <<< runChildPr
missingStream :: String -> String
missingStream str =
"Node.ChildProcess: stream not available: " <> str <> "\nThis is probably "
<> "because you passed something other than Pipe to the stdio option when "
<> "you spawned it."
<> "because you passed something other than Pipe to the stdio option when "
<> "you spawned it."

foreign import unsafeFromNullable :: forall a. String -> Nullable a -> a

Expand Down Expand Up @@ -491,7 +491,7 @@ data StdIOBehaviour

-- | Create pipes for each of the three standard IO streams.
pipe :: Array (Maybe StdIOBehaviour)
pipe = map Just [Pipe, Pipe, Pipe]
pipe = map Just [ Pipe, Pipe, Pipe ]

-- | Share `stdin` with `stdin`, `stdout` with `stdout`,
-- | and `stderr` with `stderr`.
Expand All @@ -506,8 +506,7 @@ foreign import process :: forall props. { | props }

-- | Ignore all streams.
ignore :: Array (Maybe StdIOBehaviour)
ignore = map Just [Ignore, Ignore, Ignore]

ignore = map Just [ Ignore, Ignore, Ignore ]

-- Helpers

Expand Down
10 changes: 5 additions & 5 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main = do
log "nonexistent executable: all good."

log "doesn't perform effects too early"
spawn "ls" ["-la"] defaultSpawnOptions >>= \ls -> do
spawn "ls" [ "-la" ] defaultSpawnOptions >>= \ls -> do
let _ = kill SIGTERM ls
onExit ls \exit ->
case exit of
Expand All @@ -32,7 +32,7 @@ main = do
log ("Bad exit: expected `Normally 0`, got: " <> show exit)

log "kills processes"
spawn "ls" ["-la"] defaultSpawnOptions >>= \ls -> do
spawn "ls" [ "-la" ] defaultSpawnOptions >>= \ls -> do
_ <- kill SIGTERM ls
onExit ls \exit ->
case exit of
Expand All @@ -46,9 +46,9 @@ main = do

spawnLs :: Effect Unit
spawnLs = do
ls <- spawn "ls" ["-la"] defaultSpawnOptions
ls <- spawn "ls" [ "-la" ] defaultSpawnOptions
onExit ls \exit ->
log $ "ls exited: " <> show exit
log $ "ls exited: " <> show exit
onData (stdout ls) (Buffer.toString UTF8 >=> log)

nonExistentExecutable :: Effect Unit -> Effect Unit
Expand All @@ -65,6 +65,6 @@ execLs = do

execSyncEcho :: String -> Effect Unit
execSyncEcho str = do
resBuf <- execSync "cat" (defaultExecSyncOptions {input = Just str})
resBuf <- execSync "cat" (defaultExecSyncOptions { input = Just str })
res <- Buffer.toString NE.UTF8 resBuf
log res