Fixes #25.
This commit is contained in:
parent
7f287ca684
commit
e84c5a721c
2 changed files with 13 additions and 3 deletions
|
|
@ -83,7 +83,7 @@ proc getTagsListRemote*(url: string, meth: TDownloadMethod): seq[string] =
|
||||||
result = @[]
|
result = @[]
|
||||||
case meth
|
case meth
|
||||||
of TDownloadMethod.Git:
|
of TDownloadMethod.Git:
|
||||||
var (output, exitCode) = execCmdEx("git ls-remote --tags " & url)
|
var (output, exitCode) = doCmdEx("git ls-remote --tags " & url)
|
||||||
if exitCode != QuitSuccess:
|
if exitCode != QuitSuccess:
|
||||||
raise newException(EOS, "Unable to query remote tags for " & url &
|
raise newException(EOS, "Unable to query remote tags for " & url &
|
||||||
". Git returned: " & output)
|
". Git returned: " & output)
|
||||||
|
|
@ -122,9 +122,9 @@ proc getHeadName*(meth: TDownloadMethod): string =
|
||||||
|
|
||||||
proc checkUrlType*(url: string): TDownloadMethod =
|
proc checkUrlType*(url: string): TDownloadMethod =
|
||||||
## Determines the download method based on the URL.
|
## Determines the download method based on the URL.
|
||||||
if execCmdEx("git ls-remote " & url).exitCode == QuitSuccess:
|
if doCmdEx("git ls-remote " & url).exitCode == QuitSuccess:
|
||||||
return TDownloadMethod.Git
|
return TDownloadMethod.Git
|
||||||
elif execCmdEx("hg identify " & url).exitCode == QuitSuccess:
|
elif doCmdEx("hg identify " & url).exitCode == QuitSuccess:
|
||||||
return TDownloadMethod.Hg
|
return TDownloadMethod.Hg
|
||||||
else:
|
else:
|
||||||
raise newException(EBabel, "Unable to identify url.")
|
raise newException(EBabel, "Unable to identify url.")
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,20 @@ type
|
||||||
EBabel* = object of EBase
|
EBabel* = object of EBase
|
||||||
|
|
||||||
proc doCmd*(cmd: string) =
|
proc doCmd*(cmd: string) =
|
||||||
|
let bin = cmd.split(' ')[0]
|
||||||
|
if findExe(bin) == "":
|
||||||
|
raise newException(EBabel, "'" & bin & "' not in PATH.")
|
||||||
|
|
||||||
let exitCode = execCmd(cmd)
|
let exitCode = execCmd(cmd)
|
||||||
if exitCode != QuitSuccess:
|
if exitCode != QuitSuccess:
|
||||||
raise newException(EBabel, "Execution failed with exit code " & $exitCode)
|
raise newException(EBabel, "Execution failed with exit code " & $exitCode)
|
||||||
|
|
||||||
|
proc doCmdEx*(cmd: string): tuple[output: TaintedString, exitCode: int] =
|
||||||
|
let bin = cmd.split(' ')[0]
|
||||||
|
if findExe(bin) == "":
|
||||||
|
raise newException(EBabel, "'" & bin & "' not in PATH.")
|
||||||
|
return execCmdEx(cmd)
|
||||||
|
|
||||||
template cd*(dir: string, body: stmt) =
|
template cd*(dir: string, body: stmt) =
|
||||||
## Sets the current dir to ``dir``, executes ``body`` and restores the
|
## Sets the current dir to ``dir``, executes ``body`` and restores the
|
||||||
## previous working dir.
|
## previous working dir.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue