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

Test case failing : return › early-error › write to fast-exit subprocess #1162

Closed
ramnathnayak-ibm opened this issue Oct 21, 2024 · 7 comments · Fixed by #1163
Closed

Comments

@ramnathnayak-ibm
Copy link

ramnathnayak-ibm commented Oct 21, 2024

Hi!

I am trying to build execa on RHEL ppc64le, for the latest version v9.4.1.
Using npm install to build it. No errors while installing.
For tests using npm tests. Facing one test error.

return › early-error › write to fast-exit subprocess

  test/return/early-error.js:73

   72:     } catch (error) {
   73:       t.is(error.code, 'EPIPE');
   74:     }

  Difference (- actual, + expected):

  - undefined
  + 'EPIPE'

  › file://test/return/early-error.js:73:6

  ─

  1 test failed

I see this test-cases are particularly for platforms other than Windows. I am running it on Linux ppc64le. May I know why I am facing this error?

Thanks

@ehmicky
Copy link
Collaborator

ehmicky commented Oct 23, 2024

Hi @ramnathnayak-ibm,

What do you get if you add the following two lines to test/return/early-error.js?

	test('write to fast-exit subprocess', async t => {
		// Try-catch here is necessary, because this test is not 100% accurate
		// Sometimes subprocess can manage to accept input before exiting
		try {
			await execa(`fast-exit-${process.platform}`, [], {input: 'data'});
			t.pass();
		} catch (error) {
+            console.log(process.platform);
+            console.log(error);
			t.is(error.code, 'EPIPE');
		}
	});

@ramnathnayak-ibm
Copy link
Author

Hi @ehmicky,

This is what I get.

linux
ExecaError: Command failed with exit code 126: fast-exit-linux

/execa/test/fixtures/fast-exit-linux: /execa/test/fixtures/fast-exit-linux: cannot execute binary file
    at getFinalError (file:///execa/lib/return/final-error.js:6:9)
    at makeError (file:///execa/lib/return/result.js:108:16)
    at getAsyncResult (file:///execa/lib/methods/main-async.js:167:4)
    at handlePromise (file:///execa/lib/methods/main-async.js:150:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///execa/test/return/early-error.js:69:4 {
  shortMessage: 'Command failed with exit code 126: fast-exit-linux',
  command: 'fast-exit-linux',
  escapedCommand: 'fast-exit-linux',
  cwd: '/execa',
  durationMs: 102.833081,
  failed: true,
  timedOut: false,
  isCanceled: false,
  isGracefullyCanceled: false,
  isTerminated: false,
  isMaxBuffer: false,
  isForcefullyTerminated: false,
  exitCode: 126,
  stdout: '',
  stderr: '/execa/test/fixtures/fast-exit-linux: /execa/test/fixtures/fast-exit-linux: cannot execute binary file',
  stdio: [
    undefined,
    '',
    '/execa/test/fixtures/fast-exit-linux: /execa/test/fixtures/fast-exit-linux: cannot execute binary file'
  ],
  ipcOutput: [],
  pipedFrom: []

@ehmicky
Copy link
Collaborator

ehmicky commented Oct 23, 2024

Thanks. I opened a PR at #1163 to fix this.

Could you please confirm what os.arch() returns on your machine?

@ramnathnayak-ibm
Copy link
Author

Its ppc64le.

# arch
ppc64le

Thanks a lot @ehmicky for your quick assistance.

@ehmicky
Copy link
Collaborator

ehmicky commented Oct 24, 2024

This should be fixed now. 👍

@ramnathnayak-ibm
Copy link
Author

@ehmicky Has this change reflected on the latest tag i.e. v9.4.1. If not then can you please do this?
Thanks.

@ehmicky
Copy link
Collaborator

ehmicky commented Oct 26, 2024

There's no need since automated tests are not released nor published to npm, and this change only impacts automated tests.

How are you installing Execa?

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 a pull request may close this issue.

2 participants