Class: AssLauncher::Support::Shell::RunAssResult Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ass_launcher/support/shell.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Contain result for execute 1C binary see ProcessHolder#result

Defined Under Namespace

Classes: RunAssError, UnexpectedAssOut

Constant Summary collapse

CUT_ASSOUT_LENGTH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

640

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exitstatus, out, err, assout) ⇒ RunAssResult

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RunAssResult.



309
310
311
312
313
314
# File 'lib/ass_launcher/support/shell.rb', line 309

def initialize(exitstatus, out, err, assout)
  @err = err
  @out = out
  @exitstatus = exitstatus
  @assout = assout
end

Instance Attribute Details

#assoutObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



307
308
309
# File 'lib/ass_launcher/support/shell.rb', line 307

def assout
  @assout
end

#errObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



307
308
309
# File 'lib/ass_launcher/support/shell.rb', line 307

def err
  @err
end

#exitstatusObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



307
308
309
# File 'lib/ass_launcher/support/shell.rb', line 307

def exitstatus
  @exitstatus
end

#expected_assoutObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



308
309
310
# File 'lib/ass_launcher/support/shell.rb', line 308

def expected_assout
  @expected_assout
end

#outObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



307
308
309
# File 'lib/ass_launcher/support/shell.rb', line 307

def out
  @out
end

Instance Method Details

#expected_assout?Boolean

Note:

Sometimes 1C does what we not expects. For example, we ask to create InfoBase File=“tmptmp.ib” however 1C make files of infobase in root of ‘tmp' directory and exits with status 0. In this case we have to check assout for answer executed success? or not.

Checkin #assout string If existstatus != 0 checking assout value skiped and return true It work when exitstatus == 0 but taken unexpected assout

Returns:

  • (Boolean)


360
361
362
363
364
# File 'lib/ass_launcher/support/shell.rb', line 360

def expected_assout?
  return true if expected_assout.nil?
  return true if exitstatus != 0
  ! (expected_assout =~ assout).nil?
end

#success?Boolean

Returns:

  • (Boolean)


336
337
338
# File 'lib/ass_launcher/support/shell.rb', line 336

def success?
  exitstatus == 0 && expected_assout?
end

#verify!Object

Verivfy of result and raises unless #success?

Raises:

  • (UnexpectedAssOut)
    • exitstatus == 0 but taken unexpected

    assout AssLauncher::Support::Shell::RunAssResult.!!#expected_assout?

  • (RunAssError)
    • if other errors taken



321
322
323
324
325
# File 'lib/ass_launcher/support/shell.rb', line 321

def verify!
  fail UnexpectedAssOut, cut_assout unless expected_assout?
  fail RunAssError, "#{err}#{cut_assout}" unless success?
  self
end