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

Try to catch EnvironmentSectionNotValid #94

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ const IGNORED_WARNINGS = [
`Key 'use_only_tar_bz2' is not a known primitive parameter.`,
];

/**
* warnings that should be errors
*/
const FORCED_ERRORS = [
// conda env create will ignore invalid sections and move on
`EnvironmentSectionNotValid`,
];

/**
* avoid spurious conda warnings before we have a chance to update them
*/
Expand All @@ -93,6 +101,18 @@ async function execute(command: string): Promise<Result> {
let options: exec.ExecOptions = {
errStream: new stream.Writable(),
listeners: {
stdout: (data: Buffer) => {
const stringData = data.toString();
for (const forced_error of FORCED_ERRORS) {
if (stringData.includes(forced_error)) {
return {
ok: false,
error: new Error(`"${command}" failed with "${forced_error}"`),
};
}
}
return data;
},
stderr: (data: Buffer) => {
const stringData = data.toString();
for (const ignore of IGNORED_WARNINGS) {
Expand Down