Skip to content
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

Correct paths windows backslashes and spawn shell param. #112

Merged
merged 3 commits into from
Jan 11, 2025

Conversation

wclr
Copy link
Contributor

@wclr wclr commented Jan 1, 2025

This fixes running the package on Windows.

Should fix this: #104

  • Updates package-set to the latest and corresponding code for handiling child process and streams.
  • Fixes handling paths slashes on windows.
  • Enables running spawn in shell (need on windows because of the recent security update). Not sure if it is better to enable it only on Windows.

, Just $ ShareStream (unsafeCoerce Process.stdout)
, Just $ ShareStream (unsafeCoerce Process.stderr)
-- To preserve colors in stdout need to pass it into spawn's stdio.
childProc <- unsafeCoerce <$> UnsafeChildProcess.spawn' command args
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the unsafeCoerce needed here? Presumably the map is unnecessary?

Copy link
Contributor Author

@wclr wclr Jan 11, 2025

Choose a reason for hiding this comment

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

Because below used ChildProcess.stdin and other functions for safe ChildProcess, if to use unsafeStdin it returns Nullable Writtable, it should be handled, map can be ommited yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you suppose it is more correct not ot use unsafeCoerce here, I can fix this too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

pure $ effectCanceler do
ChildProcess.kill SIGABRT childProc
void $ ChildProcess.kill' (stringSignal "SIGABRT") childProc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this use https://pursuit.purescript.org/packages/purescript-node-child-process/11.1.0/docs/Node.ChildProcess#v:killSignal to avoid the string? These functions are largely undocumented so I'm not really sure what the difference is.

Copy link
Contributor Author

@wclr wclr Jan 11, 2025

Choose a reason for hiding this comment

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

Missed this functions. Seems it it does the same just converts Signal to string and passes it to kill'.

pure $ effectCanceler do
ChildProcess.kill SIGABRT childProc
void $ ChildProcess.kill' (stringSignal "SIGABRT") childProc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here regarding killSignal.

pure $ effectCanceler $ ChildProcess.kill SIGABRT childProc
childProc <- ChildProcess.exec' command identity (k <<< pure)
_ <- Stream.writeString' (ChildProcess.stdin childProc) UTF8 input mempty
--Stream.end (ChildProcess.stdin childProc) mempty
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this comment be removed?

_ <- Stream.writeString' (ChildProcess.stdin childProc) UTF8 input mempty
--Stream.end (ChildProcess.stdin childProc) mempty
(ChildProcess.stdin childProc) # on_ finishH mempty
pure $ effectCanceler $ void $ ChildProcess.kill' (stringSignal "SIGABRT") childProc
Copy link
Collaborator

Choose a reason for hiding this comment

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

killSignal.

@natefaubion
Copy link
Collaborator

Since you bumped the package set, we need to change the CI script:

run: npm i --global purescript@0.15.10 purs-tidy@latest spago@latest purescript-psa@latest esbuild@latest

@wclr wclr requested a review from natefaubion January 11, 2025 20:14
@natefaubion natefaubion merged commit 61fd499 into aristanetworks:main Jan 11, 2025
3 checks passed
@natefaubion
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants