下载失败时退出码设置为`1`

This commit is contained in:
nilaoda 2022-11-16 21:04:15 +08:00
parent 1460a2f7d1
commit 9e9a307f7c
1 changed files with 13 additions and 10 deletions

View File

@ -322,24 +322,27 @@ namespace N_m3u8DL_RE
Headers = parserConfig.Headers, //使用命令行解析得到的Headers
};
var result = false;
if (!livingFlag)
{
//开始下载
var sdm = new SimpleDownloadManager(downloadConfig);
var result = await sdm.StartDownloadAsync(selectedStreams);
if (result)
Logger.InfoMarkUp("[white on green]Done[/]");
else
Logger.ErrorMarkUp("[white on red]Failed[/]");
result = await sdm.StartDownloadAsync(selectedStreams);
}
else
{
var sldm = new SimpleLiveRecordManager2(downloadConfig, selectedStreams, extractor);
var result = await sldm.StartRecordAsync();
if (result)
Logger.InfoMarkUp("[white on green]Done[/]");
else
Logger.ErrorMarkUp("[white on red]Failed[/]");
result = await sldm.StartRecordAsync();
}
if (result)
{
Logger.InfoMarkUp("[white on green]Done[/]");
}
else
{
Logger.ErrorMarkUp("[white on red]Failed[/]");
Environment.ExitCode = 1;
}
}