@@ -89,7 +89,10 @@ async function findOrSetupPython(version: string, setupDir: string, arch: string
89
89
const { setupActionsPython } = await import ( "./actions_python" )
90
90
await setupActionsPython ( version , setupDir , arch )
91
91
92
- foundPython = ( await findPython ( setupDir ) ) !
92
+ foundPython = await findPython ( setupDir )
93
+ if ( foundPython === undefined ) {
94
+ throw new Error ( "Python binary could not be found" )
95
+ }
93
96
const binDir = dirname ( foundPython )
94
97
installInfo = { bin : foundPython , installDir : binDir , binDir }
95
98
} catch ( err ) {
@@ -103,7 +106,10 @@ async function findOrSetupPython(version: string, setupDir: string, arch: string
103
106
}
104
107
105
108
if ( foundPython === undefined || installInfo . bin === undefined ) {
106
- foundPython = ( await findPython ( setupDir ) ) !
109
+ foundPython = await findPython ( setupDir )
110
+ if ( foundPython === undefined ) {
111
+ throw new Error ( "Python binary could not be found" )
112
+ }
107
113
installInfo . bin = foundPython
108
114
}
109
115
@@ -120,7 +126,10 @@ async function setupPythonSystem(setupDir: string, version: string) {
120
126
await setupChocoPack ( "python3" , version )
121
127
}
122
128
// Adding the bin dir to the path
123
- const bin = ( await findPython ( setupDir ) ) !
129
+ const bin = await findPython ( setupDir )
130
+ if ( bin === undefined ) {
131
+ throw new Error ( "Python binary could not be found" )
132
+ }
124
133
const binDir = dirname ( bin )
125
134
/** The directory which the tool is installed to */
126
135
await addPath ( binDir )
0 commit comments