mirror of
https://github.com/docker/login-action.git
synced 2025-04-19 01:26:45 +00:00
Fix cmd output
This commit is contained in:
parent
04f461cc60
commit
16d491f0ca
2 changed files with 18 additions and 10 deletions
13
src/aws.ts
13
src/aws.ts
|
@ -6,6 +6,10 @@ export const isECR = async (registry: string): Promise<boolean> => {
|
|||
return registry.includes('amazonaws');
|
||||
};
|
||||
|
||||
export const getRegion = async (registry: string): Promise<string> => {
|
||||
return registry.substring(registry.indexOf('ecr.') + 4, registry.indexOf('.amazonaws'));
|
||||
};
|
||||
|
||||
export const getCLI = async (): Promise<string> => {
|
||||
return io.which('aws', true);
|
||||
};
|
||||
|
@ -14,8 +18,11 @@ export const getCLICmdOutput = async (args: string[]): Promise<string> => {
|
|||
return execm.exec(await getCLI(), args, true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
} else if (res.stderr != '') {
|
||||
return res.stderr.trim();
|
||||
} else {
|
||||
return res.stdout.trim();
|
||||
}
|
||||
return res.stdout;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -30,7 +37,3 @@ export const parseCLIVersion = async (stdout: string): Promise<string | undefine
|
|||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const getRegion = async (registry: string): Promise<string> => {
|
||||
return registry.substring(registry.indexOf('ecr.') + 4, registry.indexOf('.amazonaws'));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue