Skip to content

Commit c83eb3b

Browse files
authored
Merge pull request #38 from python-project-templates/tkp/raise
raise on subprocess error
2 parents d2e7a70 + cc19950 commit c83eb3b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hatch_rs/structs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ def execute(self):
117117
chdir(self.path)
118118

119119
for command in self.commands:
120-
system_call(command)
120+
ret = system_call(command)
121+
if ret != 0:
122+
raise RuntimeError(f"hatch-rs build command failed with exit code {ret}: {command}")
121123

122124
# Go back to original path
123125
chdir(str(cwd))
@@ -164,7 +166,10 @@ def execute(self):
164166
library_name = f"{self.module}/{file_name}.so"
165167
self._libraries.append(library_name)
166168
copy_command = f"cp -f {file} {cwd}/{library_name}"
167-
system_call(copy_command)
169+
ret = system_call(copy_command)
170+
if ret != 0:
171+
raise RuntimeError(f"hatch-rs copy command failed with exit code {ret}: {copy_command}")
172+
168173
return self.commands
169174

170175
def cleanup(self):

0 commit comments

Comments
 (0)