monotone

monotone Commit Details

Date:2009-07-09 15:39:15 (9 years 10 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.lib.automate-stdio
Commit:20448d68a515d397919ebc349b43c7025b0b68e2
Parents: 5af35bcd8cad5741a2e924c5cda83ffcc3bd28d6
Message:- Made the exception handling code more consistent and cleaner.

- Made other small consistency tidy ups.
Changes:
Mlib/Monotone/AutomateStdio.pm (9 diffs)

File differences

lib/Monotone/AutomateStdio.pm
38993899
39003900
39013901
3902
39033902
39043903
39053904
......
40384037
40394038
40404039
4041
4040
40424041
40434042
40444043
40454044
40464045
4047
4048
4046
40494047
4050
4048
40514049
40524050
40534051
......
40654063
40664064
40674065
4068
4066
40694067
40704068
40714069
......
40974095
40984096
40994097
4098
41004099
41014100
41024101
......
41684167
41694168
41704169
4171
41724170
41734171
41744172
......
42354233
42364234
42374235
4238
4236
42394237
42404238
42414239
......
42984296
42994297
43004298
4301
4299
43024300
43034301
43044302
......
43464344
43474345
43484346
4349
4347
43504348
43514349
43524350
43534351
43544352
4355
4353
43564354
43574355
43584356
43594357
43604358
43614359
4362
4360
43634361
43644362
43654363
......
43694367
43704368
43714369
4372
4370
43734371
43744372
43754373
my($buffer,
$buffer_ref,
$db_locked_exception,
$exception,
$handler,
$handler_data,
$in,
# Attempt to read the output of the command, rethrowing any exception
# that does not relate to locked databases.
$db_locked_exception = $read_ok = $retry = 0;
$db_locked_exception = $read_ok = $retry = undef;
eval
{
$read_ok = $this->mtn_read_output($buffer_ref);
$$buffer_ref = decode_utf8($$buffer_ref) if ($in_as_utf8);
};
$exception = $@;
if ($exception)
if ($@)
{
if ($exception =~ m/$database_locked_re/)
if ($@ =~ m/$database_locked_re/)
{
# We need to properly closedown the mtn subprocess at this
}
else
{
&$croaker($exception);
&$croaker($@);
}
}
&$carper($this->{error_msg});
return;
}
}
}
$$buffer = "";
$chunk_start = 1;
$err_occurred = 0;
$last = "m";
$offset = 0;
do
. join("", <$err>));
}
$chunk_start = 0;
$chunk_start = undef;
}
my(@args,
$cwd,
$err,
$exception,
$my_pid,
$version);
$this->{mtn_err},
@args);
};
$err = $@;
$exception = $@;
chdir($cwd);
# Check for errors (remember that open3() errors can happen in both the
# parent and child processes).
if ($err)
if ($exception)
{
if ($$ != $my_pid)
{
# In the child process so all we can do is complain and exit.
print(STDERR "open3 failed: " . $err);
print(STDERR "open3 failed: " . $exception);
exit(1);
}
# In the parent process so deal with the error in the usual
# way.
&$croaker($err);
&$croaker($exception);
}
}

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status