Commits

Fabrice Gabolde committed aafc827

Handle exceptions thrown by IPC::Run::start.

Comments (0)

Files changed (1)

 sub _build_subprocess {
 
     my $self = shift;
-    my $subprocess = start($self->shell,
-                           '<', $self->input,
-                           '1>', $self->output,
-                           '2>', $self->errput)
-        or croak(sprintf(q{Could not start subprocess with '%s': return code %d},
-                         join(' ', @{$self->shell}), $?));
+    my $subprocess = eval { start($self->shell,
+                                  '<', $self->input,
+                                  '1>', $self->output,
+                                  '2>', $self->errput) };
+
+    if (my $error = $@) {
+        croak(sprintf(q{Could not start subprocess with '%s': %s},
+                      join(' ', @{$self->shell}), $@));
+    }
 
     return $subprocess;