diff options
author | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-08-26 15:12:42 +0000 |
---|---|---|
committer | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-08-26 15:12:42 +0000 |
commit | 284bf00bb2fa157063ce8d5dc58e47d38eea8209 (patch) | |
tree | 60a22f2ebe719b1fe8f7feea1b7853b231626968 /src | |
parent | ec074fcb99c44941c38775e51700d60cbd59cfd4 (diff) | |
download | luarocks-284bf00bb2fa157063ce8d5dc58e47d38eea8209.tar.gz luarocks-284bf00bb2fa157063ce8d5dc58e47d38eea8209.tar.bz2 luarocks-284bf00bb2fa157063ce8d5dc58e47d38eea8209.zip |
better error checking
git-svn-id: http://luarocks.org/svn/luarocks/trunk@49 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/command_line.lua | 1 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 3 | ||||
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 963916bd..58c54354 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -6,6 +6,7 @@ local util = require("luarocks.util") | |||
6 | local cfg = require("luarocks.cfg") | 6 | local cfg = require("luarocks.cfg") |
7 | local fs = require("luarocks.fs") | 7 | local fs = require("luarocks.fs") |
8 | local path = require("luarocks.path") | 8 | local path = require("luarocks.path") |
9 | local dir = require("luarocks.dir") | ||
9 | 10 | ||
10 | --- Display an error message and exit. | 11 | --- Display an error message and exit. |
11 | -- @param message string: The error message. | 12 | -- @param message string: The error message. |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index fc0535a9..407d72c5 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -263,6 +263,9 @@ function get_sources(rockspec, extract, dest_dir) | |||
263 | if extract then | 263 | if extract then |
264 | fs.change_dir(store_dir) | 264 | fs.change_dir(store_dir) |
265 | fs.unpack_archive(rockspec.source.file) | 265 | fs.unpack_archive(rockspec.source.file) |
266 | if not fs.exists(rockspec.source.dir) then | ||
267 | return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file | ||
268 | end | ||
266 | fs.pop_dir() | 269 | fs.pop_dir() |
267 | end | 270 | end |
268 | return source_file, store_dir | 271 | return source_file, store_dir |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index b4cb43a7..c8fefd4d 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -14,7 +14,8 @@ local dir_stack = {} | |||
14 | -- @return boolean: true if command succeeds (status code 0), false | 14 | -- @return boolean: true if command succeeds (status code 0), false |
15 | -- otherwise. | 15 | -- otherwise. |
16 | function execute_string(cmd) | 16 | function execute_string(cmd) |
17 | if os.execute("cd " .. fs.Q(fs.current_dir()) .. " && " .. cmd) == 0 then | 17 | local actual_cmd = "cd " .. fs.Q(fs.current_dir()) .. " && " .. cmd |
18 | if os.execute(actual_cmd) == 0 then | ||
18 | return true | 19 | return true |
19 | else | 20 | else |
20 | return false | 21 | return false |