Skip to content

Commit e85a79f

Browse files
authored
better errors for admin install and pip install (#373)
1 parent b9a7f56 commit e85a79f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

go/admin/commands.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ func createTarGz(funcDir string) ([]byte, error) {
136136
return nil
137137
}
138138

139+
if !info.Mode().IsRegular() {
140+
return fmt.Errorf("cannot archive non-regular file %q (mode: %s)", path, info.Mode().String())
141+
}
142+
139143
relPath, err := filepath.Rel(funcDir, path)
140144
if err != nil {
141145
return fmt.Errorf("unable to compute relative path: %v", err)

go/worker/embedded/packagePullerInstaller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ def f(event):
6969
if not alreadyInstalled:
7070
try:
7171
subprocess.check_output(
72-
['pip3', 'install', '--no-deps', pkg, '--cache-dir', '/tmp/.cache', '-t', '/host/files'])
72+
['pip3', 'install', '--no-deps', pkg, '--cache-dir', '/tmp/.cache', '-t', '/host/files'],
73+
stderr=subprocess.STDOUT)
7374
except subprocess.CalledProcessError as e:
74-
print(f'pip install failed with error code {e.returncode}')
75-
print(f'Output: {e.output}')
75+
output = e.output.decode('utf-8') if e.output else ''
76+
raise Exception(f'pip install failed for {pkg} (exit code {e.returncode}): {output}') from None
7677

7778
name = pkg.split("==")[0]
7879
d = deps("/host/files")

0 commit comments

Comments
 (0)