-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
3.x fix import fallback #6385
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
base: cherry-pick/next-release
Are you sure you want to change the base?
3.x fix import fallback #6385
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,30 +10,26 @@ import {pluginCommands} | |
function runBinary(path: PortablePath) { | ||
const physicalPath = npath.fromPortablePath(path); | ||
|
||
if (!physicalPath) { | ||
throw Object.assign( | ||
new Error(`runBinary ${path} ENOENT`), | ||
{code: `ENOENT`, errno: -2}, | ||
); | ||
} | ||
|
||
process.on(`SIGINT`, () => { | ||
// We don't want SIGINT to kill our process; we want it to kill the | ||
// innermost process, whose end will cause our own to exit. | ||
}); | ||
|
||
if (physicalPath) { | ||
execFileSync(process.execPath, [physicalPath, ...process.argv.slice(2)], { | ||
stdio: `inherit`, | ||
env: { | ||
...process.env, | ||
YARN_IGNORE_PATH: `1`, | ||
YARN_IGNORE_CWD: `1`, | ||
}, | ||
}); | ||
} else { | ||
execFileSync(physicalPath, process.argv.slice(2), { | ||
stdio: `inherit`, | ||
env: { | ||
...process.env, | ||
YARN_IGNORE_PATH: `1`, | ||
YARN_IGNORE_CWD: `1`, | ||
}, | ||
}); | ||
} | ||
execFileSync(process.execPath, [physicalPath, ...process.argv.slice(2)], { | ||
stdio: `inherit`, | ||
env: { | ||
...process.env, | ||
YARN_IGNORE_PATH: `1`, | ||
YARN_IGNORE_CWD: `1`, | ||
}, | ||
}); | ||
} | ||
|
||
export async function main({binaryVersion, pluginConfiguration}: {binaryVersion: string, pluginConfiguration: PluginConfiguration}) { | ||
|
@@ -99,14 +95,16 @@ export async function main({binaryVersion, pluginConfiguration}: {binaryVersion: | |
await exec(cli); | ||
return; | ||
} else if (yarnPath !== null && !ignorePath) { | ||
if (!xfs.existsSync(yarnPath)) { | ||
process.stdout.write(cli.error(new Error(`The "yarn-path" option has been set (in ${configuration.sources.get(`yarnPath`)}), but the specified location doesn't exist (${yarnPath}).`))); | ||
process.exitCode = 1; | ||
} else { | ||
try { | ||
runBinary(yarnPath); | ||
} catch (error) { | ||
process.exitCode = error.code || 1; | ||
try { | ||
runBinary(yarnPath); | ||
} catch (error) { | ||
if (error.code === `ENOENT`) | ||
process.stdout.write(cli.error(new Error(`The "yarn-path" option has been set (in ${configuration.sources.get(`yarnPath`)}), but the specified location doesn't exist (${yarnPath}).`))); | ||
|
||
if (typeof error.code === `number`) { | ||
process.exitCode = error.code; | ||
} else { | ||
process.exitCode = 1; | ||
Comment on lines
+98
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the path is set and is truthy but the file doesn't exist this wont throw the same error it did before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exit code before was a non-number string. This is not valid. Do we actually want to preserve that behavior?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I put this here specifically for consistency with old behavior - otherwise using |
||
} | ||
} | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate but it seems like this is never restored after execution of the binary?