search for: systemcallerror

Displaying 12 results from an estimated 12 matches for "systemcallerror".

2007 Oct 08
1
Getting an actual system error
Heya all, I don''t think I''ve been paying attention. When a Windows API function fails, I could have been doing this: raise SystemCallError(GetLastError()) Instead of this: # Where ''Error'' is nested under the current class. raise Error, get_last_error I''m not sure how big of a deal this is in practice, however, or if it''s even preferred for our purposes. Regards, Dan This communication is the...
2007 Oct 09
5
Playing with ReadFileScatter()
...= $INPUT_RECORD_SEPARATOR) handle = CreateFile( file, GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nil ) if handle == INVALID_HANDLE_VALUE raise SystemCallError.new(GetLastError()) end sysbuf = 0.chr * 40 GetSystemInfo(sysbuf) page_size = sysbuf[8,4].unpack(''L'')[0] # dwPageSize file_size = File.size(file) # FILE_SEGMENT_ELEMENT fse_struct = (0.chr * page_size) + (0.chr * 8) # Buffer +...
2005 Aug 07
1
Can''t rake without swig
...ersion ./rake/rakewx.rb:20:in ``'' ./rake/rakewx.rb:20:in `have_good_swig'' ./rake/rakewx.rb:254:in `create_internal_swig_tasks'' Perhaps this will work better: def have_good_swig begin version = `#{$swig_cmd} -version`.strip.split("\n")[0] rescue SystemCallError end if(!version) return false end return (version >= "SWIG Version 1.3.25" && version < "SWIG Version 2") end Roy
2006 Aug 14
2
after_create is not being called
...def after_validation if !errors.invalid?("file_path") images = get_images if images.size == 0 errors.add_to_base("There are no files in the directory #{get_images_path}") else errors.add_to_base(images.inspect) end end rescue SystemCallError errors.add_to_base("The directory #{get_images_path} does not exist") end def after_create if errors.empty? get_images.each do |image| photos.create :file => image.basename end end raise ="asdfasdfasdfa" end # some more stuff......
2017 Feb 02
3
[nbdkit PATCH 0/2] Ruby bindings for .zero
Similar to python and perl. But MUCH easier (especially considering that this is the first time I've every tried to run Ruby). I even had fun making set_error() polymorphic. Eric Blake (2): ruby: Expose nbdkit_set_error to ruby script ruby: Support zero callback plugins/ruby/example.rb | 11 ++++++++ plugins/ruby/nbdkit-ruby-plugin.pod | 54
2006 Jun 06
4
Checking if a directory is empty using File
Hi, I have one minor issue. I''m trying to check whether a directory is empty given some path to the directory. My code does the following: if(File.directory?(dirpath)) # dirpath = public/images/1 if(File.zero?(dirpath)) FileUtils.rm_rf(dirpath) end end The problem is, while testing this, if I put a file in the directory and run the above code, it still ends up deleting the
2012 Jan 11
5
augeas error: Could not evaluate: unknown error - Failed to initialize Augeas
Hi, I am running puppet 2.6.12 on a SLES11SP1 server. I get the following error message as part of the puppet catalog run on a SLED11SP1 client. Augeas[sap_host_entries](provider=augeas): Opening augeas with root /, lens path , flags 0 err: /Stage[main]/Sap/Augeas[sap_host_entries]: Could not evaluate: unknown error - Failed to initialize Augeas Can somebody shed some light on the error
2007 Oct 01
2
[ win32utils-Bugs-14360 ] Bad interaction between win32-file-stat and FileUtils
Bugs item #14360, was opened at 2007-10-01 15:00 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=14360&group_id=85 Category: win32-file-stat Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Bad interaction between win32-file-stat and FileUtils Initial Comment: Ruby
2006 May 31
7
Rails, Transactions, and statements
Hi, I have a problem where I need an auto-incremented id back from the database for a statement that has yet to be committed. The operation that uses the id may fail, and if so, I need to rollback the database. I can''t figure out how to send only the statement to the database without the commit without sending over hard coded SQL. This is what I started out with: 1 def add_album
2006 Sep 06
0
rescue?
...JAX (all of this is working so far). How would I correctly wrap the worker in a begin..rescue so that it spits out ''invalid command'' when someone types in something incorrect. Right now, I have: def start_working begin @result = IO.popen(@cmd) rescue SystemCallError @result = "Invalid or Failed Command: " + $! end end but in my view, the @result doesn''t seem to be accessible to the ajax periodical updater in the same way the @result from the popen is... what am i missing? [mp]
2006 Jun 14
2
Simple FileUtils question
Hi, I have a quick question. I am trying to create folders dinamically using FileUtils.mkdir, the problem is that if the folder already exist it gives me an error. Does anyone know if there are any options to mkdir that would let me overwrite the already existing directory? I just need to create a folder with the same name everytime. Any other solution you might suggest? Thanks. -- Posted
2006 Feb 27
1
Trapping specific errors
Hi, I have a begin rescue clause and want to trap for specific errors begin cause error rescue Excpetion => err case err when SocketError do stuff when ... # trap for ErrNo::EINVAL end end Say I get the error ErrNo::EINVAL ... how/where can I find out what the Excpetion for it is named? I have tries ErrNo::EINVAL, ErrNo::EINVALError, EINVALError, but none of these seem